sacktankluafandomcom-20200214-history
Community Curator/Source/TSWRes Draw1
function Draw.PrintIcons(t,X1,Y1,X2,Y2) t2=t2 or t local X2, Y2 = X2 or SizeX, Y2 or SizeY local FunX,FunY = X1, Y1 local DwSize, IcoSize = 1, 32 local OptSz = 32 local DISz = (IcoSize*DwSize) local Odd = false local rect = draw.rect for k,v in ipairs(t) do rect(FunX, FunY, FunX+32, FunY+32,draw.black) --print(ObjTooSizv) assert(ObjIcoSizv, "no Icon size for object "..v) Draw.Object(v, FunX + 16, FunY + 16, ObjIcoSizv, 0, SelectedMaterial, nil, true, 0) FunX = FunX + OptSz if FunX > X2 then FunX, FunY = X1, FunY + OptSz end end end function Draw.PrintStickersPopit(t,X1,Y1,X2,Y2) t2=t2 or t local X2, Y2 = X2 or SizeX, Y2 or SizeY local FunX,FunY = X1, Y1 local DwSize, IcoSize = 1, 32 local OptSz = 32 local DISz = (IcoSize*DwSize) local Odd = false local rect = draw.rect for k,v in ipairs(t) do rect(FunX, FunY, FunX+32, FunY+32,draw.black) --print(ObjTooSizv) Stickersv(FunX + 16, FunY + 16, 16) FunX = FunX + OptSz if FunX > X2 then FunX, FunY = X1, FunY + OptSz end end end function Draw.PrintMaterials(t,X1,Y1,X2,Y2) t2=t2 or t local X2, Y2 = X2 or SizeX, Y2 or SizeY local FunX,FunY = X1, Y1 local DwSize, IcoSize = 1, 32 local OptSz = 32 local DISz = (IcoSize*DwSize) local Odd = false local rect = draw.rect for k,v in pairs(t) do draw.fillrect(FunX, FunY-32, FunX+32, FunY, v) rect(FunX, FunY-32, FunX+32, FunY,draw.black) --print(ObjTooSizv) FunX = FunX + OptSz if FunX > X2 then FunX, FunY = X1, FunY + OptSz end end end function Draw.PrintStickIcons(t,X1,Y1,X2,Y2) t2=t2 or t local X2, Y2 = X2 or SizeX, Y2 or SizeY local FunX,FunY = X1, Y1 local DwSize, IcoSize = 1, 64 local OptSz = 64 local DISz = (IcoSize*DwSize) local Odd = false local Col = nil for k,v in ipairs(t) do local Func = Stickersk Odd = not Odd if Odd then Col = PlayCol1 else Col = PlayCol2 end --print(t) --print(k, v, Func) draw.fillrect(FunX, FunY, FunX+64, FunY+64, Col) Func(FunX + 32, FunY + 32, 32) FunX = FunX + OptSz if FunX + OptSz > X2 then FunX, FunY = X1, FunY + OptSz end end end -- Draw a String Box function Draw.StringBoxR(Str, X1, Y1, X2, Y2, FCol) local XSize = X2-X1 draw.fillroundedrect(X1, Y1, X2, Y2, 4, FCol) draw.roundedrect(X1, Y1, X2, Y2, 4, draw.black) draw.string(Str, X1+( (XSize) / 2 - (draw.stringsize(Str)/2)), Y2 - 24, draw.black) end function Draw.StickerEdit() end function Draw.CircleSplitLine(X, Y, Radius, Lines, Space, Col, Start) Start = Start or 0 Space = Space -- local St, En = math.pi + local Add = 1/(Lines) --print("Draw.CircleSplitLine", Add)--/math.pi) for i=1, Lines do -- Lines --print((Start+(((Add*i)+(Space))*1))/math.pi, (Start+(((Add*(i+1))-(Space))*1))/math.pi) draw.arc(X, Y, Radius, Start+(((Add*i)+(Space))*1), Start+(((Add*(i+1))-(Space))*1), Col ) end draw.fillcircle(X, Y, Radius-16, draw.black) end function Draw.LuaIcon(X1, Y1, X2, Y2) local S = .40 local XW, YH = (X2-X1)*S, (Y2-Y1)*S local LuaCol = Draw.Col255(0, 0, 128) draw.fillrect(X1, Y1, X2, Y2, draw.blue) local XO, YO = XW*(1.12-S), YH*(1.12-S) X1, Y1, X2, Y2 = X1 + XO, Y1 + YO, X2 + XO, Y2 + YO draw.circle(X1+(XW*.5), Y1+(YH*.5), XW*1.25, draw.gray) --Draw.CircleSplitLine(X1+(XW*.5), Y1+(YH*.5), XW*1.25, 32, (32/3), draw.gray, -(.5)) Unused intill function is fixed. draw.fillcircle(X1+(XW*.5), Y1+(YH*.5), XW, LuaCol) draw.fillcircle(X1+(XW*.79), Y1+(YH*.108), XW*.33, draw.white) draw.fillcircle(X1+(XW*1.5), Y1-(YH*.5), XW*.33, LuaCol) draw.setfont("Arial", XW*.82) draw.string("Lua", X1-(XW*.2), Y1+(YH*.33), draw.white) draw.setfont("Arial", 16) end function Draw.LevelIcons() end function Draw.ProgressBar(Value, X1, Y1, X2, Y2, OutCol) draw.fillroundedrect(X1, Y1, ((Value)*(X2-(X1*2)))+X1, Y2, 4, PlayCol2) draw.roundedrect(X1, Y1, X2, Y2, 4, OutCol or draw.white) end function Draw.TxtBoxHeight(String) local SSX = draw.stringsize(String) return (math.ceil(SSX/((SizeX - 98) - 98)) + 1)*16 end function Draw.MagicMouthText(String, String2) local BoxHeight = Draw.TxtBoxHeight(String) draw.fillroundedrect(98, 24, SizeX - 98, 24 + BoxHeight, 4, draw.white) draw.stringinrect(String, 98, 24, SizeX - 98, 24 + BoxHeight, draw.black) if String2 then draw.fillroundedrect(98, 8, draw.stringsize(String2) + 98, 24, 4, draw.white) draw.string(String2, 98, 8, draw.black) end end return